package com.kw.model.weixin.entry;

import java.util.Set;
import java.util.TreeSet;


public class WeiXinBaseBean {
  private String toUserName=null;
  private String fromUserName=null;
  private long createTime=0;
  private WeiXinMsgType msgType=null;
  private long msgId=0;
  private String Content=null;
  private Set<WeiXinBasePair> extendWeiXinContent=null;
  
public void add(String name,String value){
	if("tousername".equals(name.toLowerCase())){
		toUserName=value;
	}else if("fromusername".equals(name.toLowerCase())){
		fromUserName=value;
	}else if("createtime".equals(name.toLowerCase())){
		createTime=parse(value);
	}else if("msgtype".equals(name.toLowerCase())){
		msgType=WeiXinMsgType.getWeiXinMsgType(value);
	}else if("msgid".equals(name.toLowerCase())){
		msgId=parse(value);
	}else if("content".equals(name.toLowerCase())){
		Content=value;
	}else if("picurl".equals(name.toLowerCase())){
		Content=value;
	}else{
		if(extendWeiXinContent==null){
			extendWeiXinContent=new TreeSet<WeiXinBasePair>();
			extendWeiXinContent.add(new WeiXinBasePair(name,value));
		}else{
			extendWeiXinContent.add(new WeiXinBasePair(name,value));
		}
	}
	
}
  
public String getToUserName() {
	return toUserName;
}
public void setToUserName(String toUserName) {
	this.toUserName = toUserName;
}
public String getFromUserName() {
	return fromUserName;
}
public void setFromUserName(String fromUserName) {
	this.fromUserName = fromUserName;
}
public long getCreateTime() {
	return createTime;
}
public void setCreateTime(long createTime) {
	this.createTime = createTime;
}
public WeiXinMsgType getMsgType() {
	return msgType;
}
public void setMsgType(WeiXinMsgType msgType) {
	this.msgType = msgType;
}
public long getMsgId() {
	return msgId;
}
public void setMsgId(long msgId) {
	this.msgId = msgId;
}
public Set<WeiXinBasePair> getExtendWeiXinContent() {
	return extendWeiXinContent;
}
public void setExtendWeiXinContent(Set<WeiXinBasePair> extendWeiXinContent) {
	this.extendWeiXinContent = extendWeiXinContent;
}
public String getContent() {
	return Content;
}
public void setContent(String content) {
	Content = content;
}
  
private Long parse(String s){
	try{
		return Long.parseLong(s);
	}catch(NumberFormatException ex){
		
	}
	return 0L;
}
  
}
